﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using FwProject.Statistics.Dto
@model IPagedList<SalesRevenueOutputDto>
@{
    Layout = null;
}
<div id="">
    <table class="layui-table">
        <colgroup>
            <col width="300">
            <col width="200">
            <col width="200">
            <col width="200">
            <col width="200">
            <col>
        </colgroup>
        <thead>
            <tr>
                <th>订单编号</th>
                <th>订单金额</th>
                <th>商品名称</th>
                <th>商品数量</th>
                <th>商品单价</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="15">销售收入统计信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    var count = item.SalesRevenueDetils.Count;
                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            <tr>
                                @if (i == 0)
                                {
                                    <td rowspan="@count">@item.OrderNumber</td>
                                    <td rowspan="@count">@item.PayTotal</td>
                                    <td>@item.SalesRevenueDetils[i].ShopProductName</td>
                                    <td>@item.SalesRevenueDetils[i].ProductCount</td>
                                    <td>@item.SalesRevenueDetils[i].PayPrice</td>
                                }
                                else
                                {
                                    <td>@item.SalesRevenueDetils[i].ShopProductName</td>
                                    <td>@item.SalesRevenueDetils[i].ProductCount</td>
                                    <td>@item.SalesRevenueDetils[i].PayPrice</td>
                                }
                            </tr>
                        }
                    }
                }
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        @Html.PagedListPager(Model, page => Url.Action("SalesRevenue", new { id = page }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list"}))
    </div>
</div>
